/**
 * 
 */
package ch.ifage.business.dom;

import java.util.GregorianCalendar;

import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;

/**
 * @author Christian
 *
 */
public class StepPropertiesTest {
	
	/**
	 * objet testé.
	 */
	private StepProperties sp;
	
	/**
	 * départ.
	 */
	private GregorianCalendar start = new GregorianCalendar();
	
	/**
	 * fin.
	 */
	private GregorianCalendar end   = new GregorianCalendar();
	
	/**
	 * before.
	 */
	@Before
	public void init() {
		
		end.add(GregorianCalendar.SECOND, 2); // durée de 2 secondes
		sp = new StepProperties("filename.txt", start, end, 
				 Activity.ARCHIVE, "parameter", Status.SUCCESS, "log");
		end.add(GregorianCalendar.SECOND, 2); // durée de 2 secondes
	}


	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#StepProperties(java.util.GregorianCalendar, 
	 *        java.util.GregorianCalendar, ch.ifage.business.dom.Activity, java.lang.String, 
	 *        ch.ifage.business.dom.Status, java.lang.String)}.
	 */
	@Test
	public final void testStepProperties() {
		sp = new StepProperties("filename.xml", new GregorianCalendar(), new GregorianCalendar(), 
				 Activity.ARCHIVE, "parameter", Status.SUCCESS, "log");
		Assert.assertNotNull(sp);
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#getFilename()}.
	 */
	@Test
	public final void testGetFilename() {
		Assert.assertTrue(sp.getFilename().equals("filename.txt"));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#setFilename(String)}.
	 */
	@Test
	public final void testSetFilename() {
		sp.setFilename("filename.csv");
		Assert.assertTrue(sp.getFilename().equals("filename.csv"));
	}
	
	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#getStartTime()}.
	 */
	@Test
	public final void testGetStartTime() {
		Assert.assertTrue(sp.getStartTime().equals(start));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#setStartTime(java.util.GregorianCalendar)}.
	 */
	@Test
	public final void testSetStartTime() {
		sp.setStartTime(end);
		Assert.assertTrue(sp.getStartTime().equals(end));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#getEndTime()}.
	 */
	@Test
	public final void testGetEndTime() {
		Assert.assertTrue(sp.getEndTime().equals(end));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#setEndTime(java.util.GregorianCalendar)}.
	 */
	@Test
	public final void testSetEndTime() {
		sp.setEndTime(start);
		Assert.assertTrue(sp.getEndTime().equals(start));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#getActivity()}.
	 */
	@Test
	public final void testGetActivity() {
		Assert.assertTrue(sp.getActivity().equals(Activity.ARCHIVE));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#setActivity(ch.ifage.business.dom.Activity)}.
	 */
	@Test
	public final void testSetActivity() {
		sp.setActivity(Activity.COMPOSITION);
		Assert.assertTrue(sp.getActivity().equals(Activity.COMPOSITION));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#getParameter()}.
	 */
	@Test
	public final void testGetParameter() {
		Assert.assertTrue(sp.getParameter().equals("parameter"));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#setParameter(java.lang.String)}.
	 */
	@Test
	public final void testSetParameter() {
		sp.setParameter("1234");
		Assert.assertTrue(sp.getParameter().equals("1234"));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#getStatus()}.
	 */
	@Test
	public final void testGetStatus() {
		Assert.assertTrue(sp.getStatus().equals(Status.SUCCESS));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#setStatus(ch.ifage.business.dom.Status)}.
	 */
	@Test
	public final void testSetStatus() {
		sp.setStatus(Status.FAILED);
		Assert.assertTrue(sp.getStatus().equals(Status.FAILED));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#getLog()}.
	 */
	@Test
	public final void testGetLog() {
		Assert.assertTrue(sp.getLog().equals("log"));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#setLog(java.lang.String)}.
	 */
	@Test
	public final void testSetLog() {
		sp.setLog("1234");
		Assert.assertTrue(sp.getLog().equals("1234"));
	}

	/**
	 * Test method for {@link ch.ifage.business.dom.StepProperties#toString()}.
	 */
	@Test
	public final void testToString() {
		//test un peu bidon
		String s = sp.toString();
		System.out.println("Test toString Properties:");
		System.out.println(s);
		System.out.println("-------------------------");
		Assert.assertTrue(sp.toString().equals(s));
	}

}
